#include <iostream>
#include <vector>
#include <stdlib.h>
using namespace std; 
template<typename Comparable>
class BinaryHeap{
private:
	int currentSize; 
	vector<Comparable> array;
	void buildHeap(); 
	void percolateDown(int hole){
		int child; 
		Comparable tmp = array[hole]; 

		for(; hole*2 <= currentSize; hole = child){
			child = 2*hole; 
			if(child != currentSize && array[child+1]< array[child])
				child++;
			if( array[child] <tmp){
				array[hole] = array[child]; 
			}
			else
				break;
		}
		array[hole] = tmp;

	}
public:
	explicit BinaryHeap(int size = 100){

	}
	explicit BinaryHeap(const vector<Comparable>& items){

	}
	void isEmpty();
	void insert(const Comparable& x){
		if(currentSize == array.size()-1){
			array.resize(array,array.size()*2); 
		}
		int hole = ++currentSize; 
		for(; hole > 1 && x<array[hole/2]; hole = hole/2){
			array[hole] = array[hole/2];
		}
		array[hole] = x; 
	}

	void deleteMin(){
		if(isEmpty()) 
			exit(-1);
		array[1] = array[currentSize--]; 
		percolateDown(1);
	}
	void deleteMin(Comparable& minItem){
		if(isEmpty())
			exit(-1);
		minItem = array[1]; 
		array[1] = array[currentSize--]; 
		percolateDown(1);
	}

	void makeEmpty(){

	}

};
